/*
 * This file (RxSimpleFilter.java) is protected by the GNU GPL licence (v2). 
 * Please read the license.txt attached for further informations. 
 * 
 */

package alkwarel.objects;

/**
 * @author Xavier Gouchet
 * 
 */
public abstract class RxSimpleFilter extends RxFilter {

	/**
	 * Standard Constructor.
	 * 
	 * @param id
	 *            the object's id
	 * @param name
	 *            the object's name
	 */
	public RxSimpleFilter(int id, String name) {
		super(id, name);
	}
	
	/**
	 * Standard Constructor.
	 * 
	 * @param id
	 *            the object's id
	 * @param name
	 *            the object's name
	 * @param requirements
	 *            the actuator's requirements
	 */
	public RxSimpleFilter(int id, String name, String[] requirements) {
		super(id, name, requirements);
	}

	/**
	 * @see alkwarel.objects.RxFilter#Apply(alkwarel.objects.AkArtspace)
	 */
	public final boolean Apply(AkArtspace a) {
		for (int x = 0; x < a.width; x++) {
			for (int y = 0; y < a.height; y++) {
				this.RGBHSV(a.get(x, y));

				this.FilterPixel();

				this.HSVRGB();
				a.set(x, y, this.coulref);
			}
		}
		return true;
	}

	/**
	 * Apply the Roxame filtering method on one pixel at once
	 * 
	 */
	protected abstract void FilterPixel();

}
